home *** CD-ROM | disk | FTP | other *** search
- *USEFUNCS
-
- Declare Procedure Input(VAR STRING Answer,INTEGER MaxLen)
- Declare Function NumToString(Integer thisint) string
- Declare Function CurDir() string
-
- begin
- Boolean PauseYN
- Integer i
- Int FileBits,MaxAd
- String Temp,TempTwo,DirString,Ans,OrigDir,Origans,Command(10),Version(1)
- String FileList,Dash,Colon,Comma,EndDir,BitNotSet,ExitText
- String DeleteText,DeleteSure,NoParams,NoMatch,DirList,BadCommand,FlagText,RemoteOnly,BeginDL,BeginUL,ShellText
-
- OrigDir = CWD()
- Version(0) = " @X08· @X09PCBoard DOS Version 1.00 @X08· @X07Coded by @X0FM@X07av@X08erick [@X0CANTi@X08-@X0FX@X08]"
- Version(1) = " @X08· @X07Based on iNiQUiTY's MicroDOS(C) by Mike Fricker"
-
- ;Read from config file:
- Fopen 1,PpePath()+"PCBDOS.CFG",O_RD,S_DN
- Fget 1,ExitText
- Fget 1,DirString
- Fget 1,BadCommand
- Fget 1,NoParams
- Fget 1,NoMatch
- Fget 1,DeleteText
- Fget 1,DeleteSure
- Fget 1,FlagText
- Fget 1,RemoteOnly
- Fget 1,BeginDL
- Fget 1,BeginUL
- Fget 1,ShellText
- Fget 1,DirList
- Fget 1,FileList
- Fget 1,Dash
- Fget 1,Colon
- Fget 1,Comma
- Fget 1,BitNotSet
- Fget 1,EndDir
- Fclose 1
-
- RdUNet PcbNode()
- WrUNet PcbNode(), "B", UN_Name(), UN_City(), UN_Name(), ""
-
- Cls
- PrintLn ExitText
- NewLines 2
- PrintLn Version(0)
- PrintLn Version(1)
- NewLine
- MaxAd = 0
-
- :main
- StartDisp FNS
- PauseYN = false
-
- Newline
- Optext CWD()
- Print DirString
- input(ans,80-Len(CWD()))
- If (ans = "") Goto main
-
- origans = ans
- ans = Upper(ans)
-
- If (instr(ans,"/P") > 0) then
- ans = StripStr(ans,"/P")
- PauseYN = true
- endif
-
- Tokenize ans
- ans = GetToken()
-
- If (ans = "EXIT") then
- ChDir OrigDir
- End
- Endif
-
- If (ans = "?" || ans = "HELP") then
- If (PauseYN) StartDisp FCL
- DispFile PpePath()+"PCBDOS.HLP",0
- Goto next
- Endif
-
- If (ans = "DIR") then
- If (PauseYN) StartDisp FCL
- NewLines 2
- ans = GetToken()
- if (ans = "") ans = "*.*"
- temp = CurDir()
- optext temp
- PrintLn DirList
- NewLine
- temp = FindFirst(ans)
- If (Temp = "") then
- Optext ans
- PrintLn NoMatch
- Goto Next
- Endif
- i = 0
- while (temp != "") do
-
- ans = replacestr(FileList,"@FILENAME@",Trim(FileInf(temp,8)," "))
- ans = replacestr(ans,"@EXT@",Left(FileInf(temp,9),3))
- ans = replacestr(ans,"@SIZE@",Space(10 - Len(StripAtx(NumToString(FileInf(temp,4)))))+NumToString(FileInf(temp,4)))
- ans = replacestr(ans,"@DATE@",ReplaceStr(String(FileInf(temp,2)),"-",Dash))
- ans = replacestr(ans,"@TIME@",ReplaceStr(Left(String(FileInf(temp,3)),5),":",Colon))
- FileBits = FileInf(temp,5)
-
- if (IsBitSet(FileBits,0)) then
- ans = replacestr(ans,"@R@","R")
- else
- ans = replacestr(ans,"@R@",BitNotSet)
- endif
-
- if (IsBitSet(FileBits,1)) then
- ans = replacestr(ans,"@H@","H")
- else
- ans = replacestr(ans,"@H@",BitNotSet)
- endif
-
- if (IsBitSet(FileBits,2)) then
- ans = replacestr(ans,"@S@","S")
- else
- ans = replacestr(ans,"@S@",BitNotSet)
- endif
-
- if (IsBitSet(FileBits,5)) then
- ans = replacestr(ans,"@A@","A")
- else
- ans = replacestr(ans,"@A@",BitNotSet)
- endif
-
- if (Abort()) goto next
- PrintLn Ans
- inc i
-
- temp = findnext()
- endwhile
- optext NumToString(i)
- PrintLn EndDir
- Goto next
- endif
-
- If (ans = "TYPE") then
- Newlines 2
- If (PauseYN) StartDisp FCL
- DispFile GetToken(),0
- Wait
- Goto next
- Endif
-
- If (ans = "CLS") then
- Cls
- Goto next
- Endif
-
- If (left(ans,2) = "CD") then
- ans = Trim(Right(Origans,(Len(Origans)-2))," ")
- ChDir ans
- Goto next
- Endif
-
- If (ans = "MD" || ans = "MKDIR") then
- MkDir GetToken()
- Goto next
- Endif
-
- If (ans = "RD" || ans = "RMDIR") then
- ReDir GetToKen() ;Gee.. PCB's doc's fucked up on this, it's "REdir", not RMDIR
- Goto next ;least the doc's I have for PPLC 3.10 :)
- Endif
-
- ;this is where it should change drives! Doesn't work though! ;(
- ;if ((right(ans,1) = ":") && (len(ans) = 2)) then
- ; ChDir ans
- ; goto next
- ;endif
-
- If (ans = "DEL") then
- ans = GetToken()
- temp = FindFirst(ans)
- If (Temp = "") then
- Optext temp
- PrintLn NoMatch
- Goto Next
- Endif
- If (ans = "*.*") then
- Newline
- ans = "N"
- temp = CurDir()+"*.*"
- Optext temp
- InputYN DeleteSure,ans,7
- If (ans = YesChar()) then
- Delete Temp
- Endif
- Goto next
- Endif
- while (temp != "") do
- ans = "N"
- If (PauseYN) then
- Newline
- optext Trim(temp, " ")
- InputYN DeleteText,ans,7
- If (ans = YesChar()) then
- Delete Temp
- Endif
- else
- delete temp
- endif
- temp = findnext()
- endwhile
- Goto next
- Endif
-
- If (ans = "REN") then
- temp = GetToken()
- ans = GetToken()
- If (temp = "" || ans = "") then
- NewLines 2
- PrintLn NoParams
- else
- Rename Temp,Ans
- endif
- Goto next
- Endif
-
- If (ans = "EXT") then
- ans = GetToKen()
- if (ans = "") then
- NewLines 2
- PrintLn NoParams
- else
- temp = Trim(Right(Origans,(Len(Origans)-3))," ")
- ToKenize temp
- ans = GetToken()
- Newline
- Optext ans
- PrintLn ShellText
- SaveScrn
- Shell true,i,ans,GetToken()
- RestScrn
- If (Exist("PCBDOS.TXT")) then
- StartDisp FCL
- NewLines 2
- DispFile "PCBDOS.TXT",0
- Delete "PCBDOS.TXT"
- Wait
- Endif
- Endif
- Goto next
- Endif
-
- If (ans = "PPE") then
- ans = GetToKen()
- NewLines 2
- if (ans = "") then
- PrintLn NoParams
- else
- temp = Trim(Right(Origans,(Len(Origans)-3))," ")
- Call temp
- endif
- Goto next
- endif
-
- If (ans = "FLAG") then
- TempTwo = CWD()
- NewLines 2
- ans = GetToKen()
- if (ans = "") then
- PrintLn NoParams
- else
- temp = findfirst(ans)
- If (Temp = "") then
- Optext ans
- PrintLn NoMatch
- Goto Next
- Endif
- while (temp != "") do
- temp = trim(CurDir()+temp," ")
- Optext temp
- PrintLn FlagText
- ChDir OrigDir
- Flag temp
- ChDir TempTwo
- temp = findnext()
- endwhile
- endif
- ChDir TempTwo
- Goto next
- endif
-
- If (ans = "SEND") then
- If (OnLocal()) then
- NewLines 2
- PrintLn RemoteOnly
- Goto Next
- Endif
- temp = CurDir()
- NewLines 2
- ans = GetToKen()
- if (ans = "") then
- PrintLn NoParams
- else
- temp = findfirst(temp+ans)
- Fopen 1,OrigDir+"\PCBDSZ.LST",O_WR,S_DB
- while (temp != "") do
- Fputln 1, CurDir() + temp
- temp = trim(findnext()," ")
- endwhile
- Fclose 1
- PrintLn BeginDL
- Shell true,i,"ZMSEND.EXE","@"+OrigDir+"\PCBDSZ.LST"
- Delete OrigDir+"\PCBDSZ.LST"
- temp = getenv("DSZLOG")
- if (exist(temp)) delete temp
- Newline
- endif
- Goto next
- endif
-
- If (ans = "RECEIVE") then
- If (OnLocal()) then
- NewLines 2
- PrintLn RemoteOnly
- Goto Next
- Endif
- temp = CurDir()
- NewLines 2
- PrintLn BeginUL
- Shell true,i,"ZMRECV.EXE",temp
- temp = getenv("DSZLOG")
- if (exist(temp)) delete temp
- Newline
- Goto next
- Endif
-
- If (ans = "VER") then
- NewLines 2
- PrintLn Version(0)
- PrintLn Version(1)
- Goto Next
- Endif
-
- :error
- NewLine
- Print BadCommand
-
- :next
- If (MaxAd < 10) MaxAd = MaxAd + 1
-
- Command(10) = Command(9)
- Command(9) = Command(8)
- Command(8) = Command(7)
- Command(7) = Command(6)
- Command(6) = Command(5)
- Command(5) = Command(4)
- Command(4) = Command(3)
- Command(3) = Command(2)
- Command(2) = Command(1)
- Command(1) = Origans
- Goto main
-
- end
-
- Procedure Input(VAR STRING Answer,INTEGER MaxLen)
- String key
- Integer leng,i,x,y
-
- let Answer = ""
- let leng = 0
- ;let i = MaxAd
-
- :start
- let key = tinkey(0) ;Why TINKEY(0)? It uses ALOT let CPU time, cuzz the
- if (Len(key) > 1) then ;PPE doesn't have to sit a poll the KBD, PCB does!
- if (key = "UP") then
- If (i < MaxAd) then
- Command(i) = Answer
- i = i + 1
- Backup 80
- Print DirString+Command(i)
- ClrEol
- leng = len(Command(i))
- Answer = Command(i)
- Endif
- Endif
- If (key = "DOWN") then
- If (i > 0) then
- Command(i) = Answer
- i = i - 1
- Backup 80
- Print DirString+Command(i)
- ClrEol
- leng = len(Command(i))
- Answer = Command(i)
- Endif
- Endif
- Endif
- Command(i) = Answer
- if (key = chr(13)) goto End_Input
- if (key = chr(29)) goto start
- if (key = chr(27)) then
- leng = 0
- Command(i) = ""
- answer = ""
- Backup 80
- Print DirString
- ClrEol
- goto start
- endif
- if (key = chr(8)) then
- if (leng = 0) goto start
- let leng = leng - 1
- Backup 1
- Print " "
- Backup 1
- let Answer = left(Answer, leng)
- Goto start
- endif
- if (!(len(key) = 1)) goto start
- if (asc(key) < 31) goto start
- if (leng = maxlen) goto start
- let Answer = Answer + key
- let leng = leng + 1
- print "@X08",key
- backup 1
- delay 1
- print "@X07",key
- backup 1
- delay 1
- print "@X0F",key
- Goto start
- :End_input
- Answer = Trim(Command(i)," ")
-
- EndProc
-
- Function NumToString(Integer thisint) string
- int pos
- string threenum
-
- for pos = 1 to (len(thisint) / 3) + 1
- threenum = Trim(Left(Right(thisint,pos * 3),3)," ")
- if (pos = 1) then
- NumToString = threenum
- else
- if (threenum != "") NumToString = threenum + comma + NumToString
- endif
- next pos
-
- EndFunc
-
- Function CurDir() string
-
- If (!Right(CWD(),1) = "\") then
- CurDir() = CWD() + "\"
- else
- CurDir() = CWD()
- endif
-
- EndFunc
-